# findall()：提取与正则表达式匹配的,以列表的形式返回所有子字符串
import re

my_string = 'python yyds,big data yyds'
data = re.findall('yyds', my_string)
print(data)

# \S 表示任意非空字符
s = 'A message from admin.niit@niit.com.cn to student.niit@niit.com.cn about meeting @2PM'
lst = re.findall('\S+@\S+', s)
print(lst)

"""
From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008
Return-Path: <postmaster@collab.sakaiproject.org>
for <source@collab.sakaiproject.org>;
Received: (from apache@localhost)
Author: stephen.marquard@uct.ac.za
Authqqq: niit@163.com from date
"""
print("----------")
text_content = open('email.txt')
for line in text_content:
    data = re.findall('[a-zA-Z0-9]\S+@\S+[a-zA-Z0-9]',line)
    print(data)


